cmake_minimum_required(VERSION 3.19)
project(Q_BitPlayer LANGUAGES CXX)

find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets)

qt_standard_project_setup()

qt_add_executable(Q_BitPlayer
    WIN32 MACOSX_BUNDLE
    main.cpp
    widget.cpp
    widget.h
    widget.ui
    imageRes.qrc
    startuppage.h startuppage.cpp
    pageswitchbutton.h pageswitchbutton.cpp
    util.h
)

qt_add_resources(
    Q_BitPlayer
    PREFIX "/"
    FILES
    images/startupPage/
    images/admin
    images/homePage/
)

target_link_libraries(Q_BitPlayer
    PRIVATE
        Qt::Core
        Qt::Widgets
)
target_link_libraries(Q_BitPlayer PRIVATE Qt6::Widgets)
target_link_libraries(Q_BitPlayer PRIVATE Qt6::Core Qt6::Widgets)

target_include_directories(Q_BitPlayer PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

include(GNUInstallDirs)

install(TARGETS Q_BitPlayer
    BUNDLE  DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

qt_generate_deploy_app_script(
    TARGET Q_BitPlayer
    OUTPUT_SCRIPT deploy_script
    NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
